

UPDATE FLW_ID_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.1.15 (192.168.1.15)', LOCKGRANTED = to_timestamp('2019-12-04 11:28:45.441', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0;

ALTER TABLE FLW_IDENTITY_INFO ADD TENANT_ID_ VARCHAR2(255) DEFAULT '';

ALTER TABLE FLW_IDENTITY_INFO ADD UPDATE_TIME_ TIMESTAMP(6);

INSERT INTO FLW_ID_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('14', 'flowable', 'com/flowable/platform/idm/db/liquibase/flowable-idm-db-changelog.xml', SYSTIMESTAMP, 14, '7:267324337bb34d43ea7d9e45d969143e', 'addColumn tableName=FLW_IDENTITY_INFO', '', 'EXECUTED', NULL, NULL, '3.5.3', '5458926340');

ALTER TABLE FLW_IDENTITY_INFO DROP CONSTRAINT FK_IDENTITY_INFO_ID_USER;

ALTER TABLE FLW_IDENTITY_INFO DROP CONSTRAINT FK_IDENTITY_INFO_ID_GROUP;

ALTER TABLE FLW_ID_USER_ACCOUNT DROP CONSTRAINT FK_ID_USER_ACCOUNT_USER;

DROP INDEX FLW_IDX_IDM_INFO_GROUP_ID;

ALTER TABLE FLW_IDENTITY_INFO DROP COLUMN GROUP_ID_;

INSERT INTO FLW_ID_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('15', 'flowable', 'com/flowable/platform/idm/db/liquibase/flowable-idm-db-changelog.xml', SYSTIMESTAMP, 15, '7:6a800059199657c89641941be54aa754', 'dropForeignKeyConstraint baseTableName=FLW_IDENTITY_INFO, constraintName=FK_IDENTITY_INFO_ID_USER; dropForeignKeyConstraint baseTableName=FLW_IDENTITY_INFO, constraintName=FK_IDENTITY_INFO_ID_GROUP; dropForeignKeyConstraint baseTableName=FLW_ID_US...', '', 'EXECUTED', NULL, NULL, '3.5.3', '5458926340');

ALTER TABLE FLW_IDENTITY_INFO MODIFY USER_ID_ NOT NULL;

ALTER TABLE FLW_IDENTITY_INFO ADD CONSTRAINT FLW_UQ_ID_INFO_TENANT_USR_NAME UNIQUE (TENANT_ID_, USER_ID_, NAME_);

UPDATE FLW_IDENTITY_INFO INFO
            SET TENANT_ID_ = (SELECT U.TENANT_ID_ FROM FLW_ID_USER U WHERE U.ID_ = INFO.USER_ID_)
            WHERE INFO.USER_ID_ IS NOT NULL;

INSERT INTO FLW_ID_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('16', 'flowable', 'com/flowable/platform/idm/db/liquibase/flowable-idm-db-changelog.xml', SYSTIMESTAMP, 16, '7:dd8bd3f93e7f18b95c88a093a4c44ea2', 'addNotNullConstraint columnName=USER_ID_, tableName=FLW_IDENTITY_INFO; addUniqueConstraint constraintName=FLW_UQ_ID_INFO_TENANT_USR_NAME, tableName=FLW_IDENTITY_INFO; sql', '', 'EXECUTED', NULL, NULL, '3.5.3', '5458926340');

INSERT INTO FLW_IDENTITY_INFO (
            ID_,
            REV_,
            TYPE_,
            NAME_,
            TEXT_,
            USER_ID_,
            TENANT_ID_
            )
            SELECT 'IDM-' || regexp_replace(lower(SYS_GUID()), '(.{8})(.{4})(.{4})(.{4})(.{12})', '\1-\2-\3-\4-\5') AS ID_,
            0 AS REV_,
            TYPE_,
            NAME_,
            TEXT_,
            USER_ID_,
            TENANT_ID_
            FROM (
            SELECT U.ID_ AS USER_ID_, U.TENANT_ID_ AS TENANT_ID_, 'string' AS TYPE_, '__flowableState' AS NAME_, U.STATE_ AS TEXT_
            FROM FLW_ID_USER U
            WHERE U.STATE_ IS NOT NULL

            UNION

            SELECT U.ID_ AS USER_ID_, U.TENANT_ID_ AS TENANT_ID_, 'string' AS TYPE_, '__flowableSubState' AS NAME_, U.SUB_STATE_ AS TEXT_
            FROM FLW_ID_USER U
            WHERE U.SUB_STATE_ IS NOT NULL

            UNION

            SELECT U.ID_ AS USER_ID_, U.TENANT_ID_ AS TENANT_ID_, 'string' AS TYPE_, '__flowableType' AS NAME_, U.TYPE_ AS TEXT_
            FROM FLW_ID_USER U
            WHERE U.TYPE_ IS NOT NULL

            UNION

            SELECT U.ID_ AS USER_ID_, U.TENANT_ID_ AS TENANT_ID_, 'string' AS TYPE_, '__flowableSubType' AS NAME_, U.SUB_TYPE_ AS TEXT_
            FROM FLW_ID_USER U
            WHERE U.SUB_TYPE_ IS NOT NULL

            UNION

            SELECT U.ID_ AS USER_ID_, U.TENANT_ID_ AS TENANT_ID_, 'string' AS TYPE_, '__flowableLanguage' AS NAME_, U.LANGUAGE_ AS TEXT_
            FROM FLW_ID_USER U
            WHERE U.LANGUAGE_ IS NOT NULL

            UNION

            SELECT U.ID_ AS USER_ID_, U.TENANT_ID_ AS TENANT_ID_, 'string' AS TYPE_, '__flowableTheme' AS NAME_, U.THEME_ AS TEXT_
            FROM FLW_ID_USER U
            WHERE U.THEME_ IS NOT NULL

            UNION

            SELECT U.ID_ AS USER_ID_, U.TENANT_ID_ AS TENANT_ID_, 'string' AS TYPE_, '__flowablePresence' AS NAME_, U.PRESENCE_ AS TEXT_
            FROM FLW_ID_USER U
            WHERE U.PRESENCE_ IS NOT NULL

            UNION

            SELECT U.ID_ AS USER_ID_, U.TENANT_ID_ AS TENANT_ID_, 'string' AS TYPE_, '__flowableUserDefinitionKey' AS NAME_, DEF.KEY_ AS TEXT_
            FROM FLW_ID_USER U
            LEFT JOIN FLW_ID_USER_DEFINITIONS DEF ON U.USER_DEFINITION_ID_ = DEF.ID_
            WHERE U.USER_DEFINITION_ID_ IS NOT NULL

            ) INFO;

ALTER TABLE FLW_ID_USER DROP COLUMN STATE_;

ALTER TABLE FLW_ID_USER DROP COLUMN SUB_STATE_;

ALTER TABLE FLW_ID_USER DROP COLUMN TYPE_;

ALTER TABLE FLW_ID_USER DROP COLUMN SUB_TYPE_;

ALTER TABLE FLW_ID_USER DROP COLUMN LANGUAGE_;

ALTER TABLE FLW_ID_USER DROP COLUMN THEME_;

ALTER TABLE FLW_ID_USER DROP COLUMN PRESENCE_;

ALTER TABLE FLW_ID_USER DROP COLUMN PRESENCE_TIME_;

DROP INDEX FLW_IDX_USER_USER_DEF;

ALTER TABLE FLW_ID_USER DROP COLUMN USER_DEFINITION_ID_;

DROP INDEX FLW_IDX_USER_SYSTEM;

ALTER TABLE FLW_ID_USER DROP COLUMN SYSTEM_ID_;

ALTER TABLE FLW_ID_USER DROP COLUMN SYSTEM_TYPE_;

INSERT INTO FLW_ID_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('17', 'flowable', 'com/flowable/platform/idm/db/liquibase/flowable-idm-db-changelog.xml', SYSTIMESTAMP, 17, '7:a9d0e170c1635f944e2af5fc86969fa5', 'sql; dropColumn columnName=STATE_, tableName=FLW_ID_USER; dropColumn columnName=SUB_STATE_, tableName=FLW_ID_USER; dropColumn columnName=TYPE_, tableName=FLW_ID_USER; dropColumn columnName=SUB_TYPE_, tableName=FLW_ID_USER; dropColumn columnName=LA...', '', 'EXECUTED', NULL, NULL, '3.5.3', '5458926340');

UPDATE FLW_ID_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;



UPDATE FLW_LIC_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.1.15 (192.168.1.15)', LOCKGRANTED = to_timestamp('2019-12-04 11:28:48.177', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_LIC_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;



UPDATE FLW_PL_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.1.15 (192.168.1.15)', LOCKGRANTED = to_timestamp('2019-12-04 11:28:49.052', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_PL_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;



UPDATE ACT_APP_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.1.15 (192.168.1.15)', LOCKGRANTED = to_timestamp('2019-12-04 11:28:49.908', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0;

UPDATE ACT_APP_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;



UPDATE FLW_FO_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.1.15 (192.168.1.15)', LOCKGRANTED = to_timestamp('2019-12-04 11:28:50.846', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_FO_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;



UPDATE FLW_CO_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.1.15 (192.168.1.15)', LOCKGRANTED = to_timestamp('2019-12-04 11:28:51.921', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_CO_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;



UPDATE FLW_AD_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.1.15 (192.168.1.15)', LOCKGRANTED = to_timestamp('2019-12-04 11:28:52.917', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_AD_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;



UPDATE FLW_AU_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.1.15 (192.168.1.15)', LOCKGRANTED = to_timestamp('2019-12-04 11:28:53.846', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_AU_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;



UPDATE FLW_DO_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.1.15 (192.168.1.15)', LOCKGRANTED = to_timestamp('2019-12-04 11:28:54.668', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0;

CREATE TABLE FLW_DO_DATAOBJECT_INSTANCE (ID_ VARCHAR2(255) NOT NULL, REV_ INTEGER NOT NULL, DEFINITION_ID_ VARCHAR2(255) NOT NULL, DEFINITION_KEY_ VARCHAR2(255) NOT NULL, LOOKUP_ID_ VARCHAR2(128), CREATION_TIME_ TIMESTAMP(6) NOT NULL, CREATOR_ID_ VARCHAR2(128), UPDATE_TIME_ TIMESTAMP(6) NOT NULL, UPDATER_ID_ VARCHAR2(128), SCOPE_ID_ VARCHAR2(255), SUB_SCOPE_ID_ VARCHAR2(255), SCOPE_TYPE_ VARCHAR2(255), SCOPE_DEFINITION_ID_ VARCHAR2(255), CONSTRAINT PK_DO_DATAOBJECT_INSTANCES PRIMARY KEY (ID_));

INSERT INTO FLW_DO_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('4', 'flowable', 'com/flowable/dataobject/db/liquibase/flowable-dataobject-db-changelog.xml', SYSTIMESTAMP, 4, '7:bd7da678a30c8f6d484f0a72ec1ee20c', 'createTable tableName=FLW_DO_DATAOBJECT_INSTANCE', '', 'EXECUTED', NULL, NULL, '3.5.3', '5458935045');

UPDATE FLW_DO_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;



UPDATE FLW_PO_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.1.15 (192.168.1.15)', LOCKGRANTED = to_timestamp('2019-12-04 11:28:55.712', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_PO_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;



UPDATE FLW_SE_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.1.15 (192.168.1.15)', LOCKGRANTED = to_timestamp('2019-12-04 11:28:56.557', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0;

ALTER TABLE FLW_SE_DEFINITION ADD REFERENCE_KEY_ VARCHAR2(255);

INSERT INTO FLW_SE_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('2', 'flowable', 'com/flowable/serviceregistry/db/liquibase/flowable-serviceregistry-db-changelog.xml', SYSTIMESTAMP, 2, '7:fc3161b600f16922c3a5bc99c61599b8', 'addColumn tableName=FLW_SE_DEFINITION', '', 'EXECUTED', NULL, NULL, '3.5.3', '5458936886');

UPDATE FLW_SE_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;



UPDATE FLW_TP_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.1.15 (192.168.1.15)', LOCKGRANTED = to_timestamp('2019-12-04 11:28:57.560', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_TP_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;

